package com.meida.module.system.provider.controller;

import com.meida.common.mybatis.model.*;
import com.meida.common.springmvc.base.BaseController;
import com.meida.module.system.client.entity.SysSlider;
import com.meida.module.system.provider.service.SysSliderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;


/**
 * 轮播图控制器
 *
 * @author flyme
 * @date 2019-07-05
 */
@RestController
@RequestMapping("/slider/")
@Api(tags = "轮播图管理")
@ApiIgnore
public class SysSliderController extends BaseController<SysSliderService, SysSlider> {

    @ApiOperation(value = "轮播图-分页列表", notes = "轮播图分页列表 ")
    @GetMapping(value = "page")
    public ResultBody page(@RequestParam(required = false) Map params) {
        return bizService.pageList(params);
    }

    @ApiOperation(value = "轮播图-列表", notes = "轮播图列表 ")
    @GetMapping(value = "list")
    public ResultBody list(@ModelAttribute(value = "model") ListModel model) {
        return bizService.listEntityMap(model);
    }

    @ApiOperation(value = "轮播图-添加", notes = "添加轮播图")
    @PostMapping(value = "add")
    public ResultBody add(SaveModel model) {
        return bizService.add(model);
    }

    @ApiOperation(value = "轮播图-更新", notes = "更新轮播图")
    @PostMapping(value = "update")
    public ResultBody update(@ModelAttribute(value = "model") UpdateModel model) {
        return bizService.edit(model);
    }

    @ApiOperation(value = "轮播图-删除", notes = "删除轮播图")
    @PostMapping(value = "remove")
    public ResultBody remove(DeleteModel model) {
        return bizService.delete(model);
    }


    @ApiOperation(value = "轮播图-详情", notes = "轮播图详情")
    @PostMapping(value = "get")
    public ResultBody get(@ModelAttribute(value = "model") GetModel model) {
        return bizService.get(model);
    }

    @ApiOperation(value = "轮播图-发布状态", notes = "轮播图-发布状态")
    @PostMapping(value = "setSendStatus")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "ids", required = true, value = "主键", paramType = "form"),
            @ApiImplicitParam(name = "sendStatus", required = true, value = "发布状态", paramType = "query")
    })
    public ResultBody setSendStatus(@RequestParam(value = "ids") Long[] ids, @RequestParam(value = "sendStatus") Integer sendStatus) {
        return bizService.setSendStatus(ids, sendStatus);
    }

}
